package ajaxTestSuite;

import com.thoughtworks.selenium.SeleneseTestCase;

public class ConfirmButton extends SeleneseTestCase {
	@Override
	public void setUp() throws Exception {
		setUp("http://www.asp.net/", "*firefox");
		selenium.setSpeed("1000");
	}

	public void testConfirmButton() throws Exception {
		selenium.open("/ajax/ajaxcontroltoolkit/Samples/Default.aspx");
		selenium.waitForPageToLoad("30000");
		selenium.click("id=ctl00_SamplesLinks_ctl11_SamplesLink");
		selenium.waitForPageToLoad("30000");

		selenium.click("id=ctl00_SampleContent_Button");
		selenium.click("id=ctl00_SampleContent_ButtonOk");
		verifyTrue(selenium.isTextPresent("You clicked the Button at*"));

		selenium.click("id=ctl00_SampleContent_Button");
		selenium.click("id=ctl00_SampleContent_ButtonCancel");
		verifyTrue(selenium
				.isTextPresent("You hit cancel in the Confirm dialog on*"));

		selenium.click("ctl00_SampleContent_LinkButton");
		if (selenium.isAlertPresent()) {
			assertEquals("Are you sure you want to click the LinkButton?",
					selenium.getAlert());
		}
		verifyTrue(selenium.isTextPresent("You clicked the LinkButton at *"));
		System.out.println("");

	}
}